<link href="__PUBLIC__/plugins/fitui/tablegrid.css" rel="stylesheet">
<link href="__PUBLIC__/plugins/huploadify/Huploadify.css" rel="stylesheet">
<script src="__PUBLIC__/plugins/huploadify/jquery.Huploadify.js"></script>
<script src="__PUBLIC__/js/backend/format.js"></script>
<script src="__PUBLIC__/plugins/fitui/tablegrid.js"></script>
<script src="__PUBLIC__/plugins/kindeditor-4.1.10/kindeditor-all-min.js"></script>
<script src="__PUBLIC__/plugins/kindeditor-4.1.10/lang/zh_CN.js"></script>
<script src="__PUBLIC__/js/backend/mer_content.js"></script>
<style type="text/css">
.table td {
  vertical-align: top !important;
  
}
</style>
<script>
var Param = <?php echo json_encode( $param ) ?> ;
var editor ;
$(function(){
  MerContent.init(<?php echo json_encode( $config ) ?>);
  KE_Setting.uploadJson = MerContent.config.upload_ke_img_url ;
  editor = KindEditor.create('.editor' , KE_Setting );
});

</script>

<div class="page-content">
  <ol class="breadcrumb">
    <li><a href="<?php echo $home_url ?>">首页</a></li>
    <li><a href="<?php echo $catalog_url ?>"><?php echo $catalog_name ?></a></li>
    <li class="active">[<strong><?php echo $merchant_data['name'] ?></strong>] 的 <?php echo $module_name ?></li>
  </ol>
  <div class="page-content-inner"> 
    <!-- read_modal -->
    <div class="portlet blue" id="read_modal"> 
      <!-- portlet-title -->
      <div class="portlet-title">
        <div class="caption"> <i class="fa fa-users "></i> 商户 [<strong><?php echo $merchant_data['name'] ?></strong>] 的 <?php echo $module_name ?> </div>
        <div class="tools"> 
          <a href="<?php echo $module_url ?>?action=create" class="toolbtn add load_add_modal_btn" data-toggle="tooltip" data-placement="top" title="新增"></a> 
          <a class="toolbtn reload" data-toggle="tooltip" data-placement="top" title="刷新"></a> 
        </div>
      </div>
      <!-- end portlet-title -->
      <div class="portlet-body "> 
        <form class="form-inline" id="search-form" method="post" >
          <div class="form-group" style="margin-bottom:16px;">
            <label for="keyword">关键字：</label>
            <input type="text" class="form-control" id="keyword" placeholder="标题 TAG" >
          </div>
          <div class="form-group" style="margin-bottom:16px;">
            <label for="type">分类：</label>
            <select id="type" class="form-control">
              <option value="0" selected >不限分类</option>
              <?php echo form_options( $param['catalog'] ) ?>
            </select>
          </div>
          <div class="form-group" style="margin-bottom:16px;">
            <button type="submit" class="btn btn-primary" id="search_btn"><i class="fa fa-search"> </i> 查询</button>
          </div>
        </form>
        <!-- table grid -->
        <div class="table-responsive">
          <table id="data_table" class="table table-striped table-hover table-condensed">
            <thead>
              <tr>
                <th width="60" data-field="id" data-sortable="true">ID</th>
                <th width="60" data-field="sort" >排序</th>
                <th width="80" data-field="icon" data-formatter="format_img" >图标</th>
                <th width="80" data-field="catalog_text" >分类</th>
                <th width="400" data-field="title" data-formatter="format_title" >标题</th>
                <th width="80" data-field="tag" >标签</th>
                <th width="60" data-field="status" data-formatter="format_status" >状态</th>
                <th width="160" data-field="create_date" data-formatter="format_datetime" >创建时间</th>
                <th width="160" data-field="update_date" data-formatter="format_datetime" >修改时间</th>
                <th data-formatter="format_opt">操作</th>
                <th>&nbsp;</th>
              </tr>
            </thead>
          </table>
        </div>
        <!-- end table --> 
        <div class="row" style="text-align:center; margin-top:60px;">
          <button type="button" class="btn btn-lg btn-default" onClick="javascript:history.go(-1)"><i class="fa fa-arrow-left"></i> 返回</button>
        </div>
      </div>
    </div>
    <!-- end portlet read_modal --> 
    
    <!-- add_edit_modal  -->
    <div class="portlet" id="add_edit_modal" style="display:none;">
      <div class="portlet-title">
        <div class="caption"> <i class="fa fa-cogs"></i> <span id="action_label"></span> <?php echo $module_name ?> </div>
      </div>
      <div class="portlet-body ">
        <form id="submit_form" class="form-horizontal">
          <div class="form-group">
            <label class="col-sm-3 control-label">标题</label>
            <div class="col-sm-7">
              <input name="title" placeholder="标题" data-valid="required" data-tips="请填写正确的标题" type="text" class="form-control" >
            </div>
          </div>          
          <div class="form-group">
            <label class="col-sm-3 control-label">内容分类</label>
            <div class="col-sm-7">
              <select name="catalog" class="form-control" data-valid="required" data-tips="请选择正确的分类">
                <?php echo form_options( $param['catalog'] ) ?>
              </select>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">状态</label>
            <div class="col-sm-7">
              <?php echo form_radios( 'status' , $param['status'] ) ?>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">排序</label>
            <div class="col-sm-7">
              <input name="sort" placeholder="排序" data-valid="required" data-tips="请填写正确的排序" type="text" class="form-control" >
            </div>
          </div>

          <div class="form-group">
            <label class="col-sm-3 control-label">图标</label>
            <div class="col-sm-7">
              <input name="icon" placeholder="图标" type="hidden" class="form-control" >
              <div class="img-preview"></div>
              <div id="upload_icon"></div>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">标签</label>
            <div class="col-sm-7">
              <input name="tag" placeholder="标签"  type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">描述</label>
            <div class="col-sm-7">
              <textarea name="desc" rows="3" class="form-control"  data-tips="请填写正确的描述"></textarea>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">内容</label>
            <div class="col-sm-7">
              <textarea name="content" rows="3" class="form-control editor" placeholder="内容" style="width:100%;height:400px"></textarea>
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">创建时间</label>
            <div class="col-sm-7">
              <input name="create_date" placeholder="创建时间"  type="text" class="form-control" >
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-3 control-label">修改时间</label>
            <div class="col-sm-7">
              <input name="update_date" placeholder="修改时间" type="text" class="form-control" >
            </div>
          </div>
          <hr>
          <div class="row">
            <div class="col-md-12" style="text-align:center">
              <button class="btn btn-default btn-lg " id="add_edit_close_btn" type="button"><i class="fa fa-arrow-left"></i> 返回</button>
              <button class="btn btn-danger btn-lg " id="submit_btn" type="button"><i class="fa fa-edit"></i> 提交</button>
            </div>
          </div>
        </form>
      </div>
    </div>
    <!-- end portlet add_edit_modal --> 
  </div>
  <!-- end page-content-inner --> 
</div>
